package servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 *
 * servlet
 *
 * 2018/5/13-10:51
 * 2018
 * Created by wuqiang on 2018/5/13.
 */
public class ServletResponse1 extends HttpServlet {

    @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        resp.setHeader("refresh","3;");
        //如果没有URL属性，则会一直刷新
        resp.setHeader("refresh","3;url='/s4.do'");
        //有了URL属性，则会刷新到url指定的页面
        resp.getOutputStream().write("刷新3秒".getBytes());
    }
}
